package beautiful.butterfly.distributed_task_processing_engine.task_manage.task_processor;

import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class HeartBeatCheckAndReallocateTaskTimerTask extends java.util.TimerTask
{

    public TaskProcessor taskProcessor;

    public HeartBeatCheckAndReallocateTaskTimerTask(@NonNull TaskProcessor taskProcessor)
    {
        this.taskProcessor = taskProcessor;
    }

    public void run()
    {
        try
        {
            Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
            this.taskProcessor.heartBeatCheckAndReallocateTaskItems();
        } catch (Exception ex)
        {
            log.error(ex.getMessage(), ex);
        }
    }
}
